package org.htmlparser.visitors;

import java.util.Locale;
import org.htmlparser.Tag;
import org.htmlparser.tags.LinkTag;

public class LinkFindingVisitor extends NodeVisitor
{
  private int count;
  private String linkTextToFind;
  private Locale locale;

  public LinkFindingVisitor(String paramString)
  {
    this(paramString, null);
  }

  public LinkFindingVisitor(String paramString, Locale paramLocale)
  {
    this.count = 0;
    if (paramLocale == null)
      localLocale = Locale.ENGLISH;
    while (true)
    {
      this.locale = localLocale;
      this.linkTextToFind = paramString.toUpperCase(this.locale);
      return;
      localLocale = paramLocale;
    }
  }

  public int getCount()
  {
    return this.count;
  }

  public boolean linkTextFound()
  {
    int i;
    if (this.count != 0)
      i = 1;
    while (true)
    {
      return i;
      i = 0;
    }
  }

  public void visitTag(Tag paramTag)
  {
    if ((paramTag instanceof LinkTag) && (-1 != ((LinkTag)paramTag).getLinkText().toUpperCase(this.locale).indexOf(this.linkTextToFind)))
      this.count = (1 + this.count);
  }
}